import { defineStore } from "pinia";
import { ref } from "vue";

import { GetAllVersionsFromGameDir } from "../wailsjs/go/launch/Version";
import { GetDefaultGameDirectory } from "../wailsjs/go/preference/Preference";

export const useLaunchStore = defineStore('Launch', () => {
    const versionLists = ref([])
    const versionName = ref("")

    GetDefaultGameDirectory().then(dirPath => {
        GetAllVersionsFromGameDir(dirPath).then(versionNames => {
            for (let v of versionNames) {
                versionLists.value.push({
                    label: v,
                    value: a
                })
            }
        })
    })

    return {
        versionLists,
        versionName
    }
})